<template>
  <div class="cleaning-services">
    <div class="section-header">
      <h3 class="section-title">洁净家</h3>
    </div>
    
    <div class="services-list">
      <div
        v-for="(service, index) in cleaningServiceInfo"
        :key="index"
        class="service-card"
        @click="handleServiceClick(service)"
      >
        <div class="service-image">
          <img :src="service.img" :alt="service.title" />
        </div>
        <div class="service-content">
          <div class="service-info">
            <div class="location-info">
              <img src="@/assets/imgs/location.svg" alt="位置" class="location-icon" />
              <span class="location-text">朝阳，吉祥公寓</span>
            </div>
            <h4 class="service-title">{{ service.title }}</h4>
            <p class="service-subtitle">{{ service.subTitle }}</p>
            <div class="price-info">
              <span class="current-price">{{ service.priceAfterDiscounts }}</span>
              <span class="original-price">{{ service.originalPrice }}</span>
            </div>
          </div>
          <div class="service-actions">
            <button class="action-btn contact-btn">电话</button>
            <button class="action-btn visit-btn">预约</button>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
const props = defineProps({
  cleaningServiceInfo: {
    type: Array,
    default: () => []
  }
})

const emit = defineEmits(['service-click'])

const handleServiceClick = (service) => {
  emit('service-click', service)
}
</script>

<style scoped>
.cleaning-services {
  background-color: #fff;
  margin: 0 16px 20px;
  border-radius: 16px;
  padding: 20px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.section-header {
  margin-bottom: 16px;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.services-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.service-card {
  display: flex;
  border: 1px solid #f0f0f0;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  background-color: #fff;
}

.service-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  border-color: #409eff;
}

.service-image {
  width: 120px;
  height: 90px;
  flex-shrink: 0;
  overflow: hidden;
}

.service-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.service-content {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.service-info {
  flex: 1;
}

.location-info {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
}

.location-icon {
  width: 12px;
  height: 12px;
  margin-right: 4px;
}

.location-text {
  font-size: 12px;
  color: #666;
}

.service-title {
  font-size: 14px;
  font-weight: 500;
  color: #333;
  margin: 0 0 4px 0;
  line-height: 1.3;
}

.service-subtitle {
  font-size: 12px;
  color: #666;
  margin: 0 0 8px 0;
  line-height: 1.3;
}

.price-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.current-price {
  font-size: 16px;
  font-weight: 600;
  color: #e74c3c;
}

.original-price {
  font-size: 12px;
  color: #999;
  text-decoration: line-through;
}

.service-actions {
  display: flex;
  gap: 8px;
}

.action-btn {
  flex: 1;
  padding: 6px 12px;
  border: 1px solid #409eff;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.contact-btn {
  background-color: #fff;
  color: #409eff;
}

.contact-btn:hover {
  background-color: #409eff;
  color: #fff;
}

.visit-btn {
  background-color: #409eff;
  color: #fff;
}

.visit-btn:hover {
  background-color: #337ab7;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .cleaning-services {
    margin: 0 12px 16px;
    padding: 16px 12px;
  }
  
  .section-title {
    font-size: 16px;
  }
  
  .services-list {
    gap: 12px;
  }
  
  .service-card {
    flex-direction: column;
  }
  
  .service-image {
    width: 100%;
    height: 120px;
  }
  
  .service-content {
    padding: 12px;
  }
  
  .service-title {
    font-size: 13px;
  }
  
  .service-subtitle {
    font-size: 11px;
  }
  
  .current-price {
    font-size: 14px;
  }
  
  .original-price {
    font-size: 11px;
  }
  
  .action-btn {
    padding: 8px 16px;
    font-size: 11px;
  }
}
</style>
